import {createRouter,createWebHistory,RouteRecordRaw} from "vue-router";

import NProgress from 'nprogress'
import 'nprogress/nprogress.css'



const routers: RouteRecordRaw[] = [
  {
    path: "/",
    name: "index",
    // component: () => import("@/views/start_port.vue"),
    component: () => import("@/views/index.vue"),
    children: [
      {
        path: "/info",
        name: "info",
        component: () => import("@/views/info.vue"),
      }
    ]
  },


]
const router = createRouter({
  history: createWebHistory(),
  routes: routers
})

router.beforeEach((to, from, next) => {
  // 做一些加载前的操作
  NProgress.start()
  next()
})

router.afterEach(() => {
  // 关闭进度条
  NProgress.done()
})

// 路由守卫
router.beforeResolve(async to => {
  console.log(to)
})

export default router
